#include <iostream>
#include <string>
#include <cctype>

using namespace std;

// Token 类型枚举
enum TokenType {
    // 关键字
    INT, VOID, IF, ELSE, WHILE, BREAK, CONTINUE, RETURN,
    // 标识符和数字
    IDENT, NUMBER,
    // 运算符
    PLUS, MINUS, MUL, DIV, MOD,
    ASSIGN, EQ, NEQ, LT, GT, LE, GE, AND, OR, NOT,
    // 分隔符
    LPAREN, RPAREN, LBRACE, RBRACE, SEMICOLON, COMMA,
    // 结束标记
    EOF_TOKEN
};

// Token 结构
struct Token {
    TokenType type;
    string value;
    int line;
    int column;

    Token(TokenType t, const string& v, int l, int c)
        : type(t), value(v), line(l), column(c) {}
};

class Lexer {
private:
    string input;
    size_t pos;
    int line;
    int column;

    // 查看当前字符（不移动指针）
    char peek() const {
        if (pos >= input.size()) return EOF;
        return input[pos];
    }

    // 消费当前字符并移动指针
    char consume() {
        if (pos >= input.size()) return EOF;
        char c = input[pos++];
        if (c == '\n') {
            line++;
            column = 1;
        } else {
            column++;
        }
        return c;
    }

    // 回退一个字符
    void unconsume() {
        if (pos > 0) {
            pos--;
            char c = input[pos];
            if (c == '\n') {
                line--;
                column = 1; 
            } else {
                column--;
            }
        }
    }

    // 跳过空白字符和注释
    void skipWhitespaceAndComments() {
        while (true) {
            char c = peek();
            if (isspace(c)) {
                consume();
            } else if (c == '/') {
                if (pos + 1 < input.size()) {
                    if (input[pos + 1] == '/') {
                        // 跳过单行注释
                        skipSingleLineComment();
                    } else if (input[pos + 1] == '*') {
                        // 跳过多行注释
                        skipMultiLineComment();
                    } else {
                        break;
                    }
                } else {
                    break;
                }
            } else {
                break;
            }
        }
    }

    // 跳过单行注释（// ...）
    void skipSingleLineComment() {
        consume(); // 消费 '/'
        consume(); // 消费 '/'
        while (peek() != '\n' && peek() != EOF) {
            consume();
        }
    }

    // 跳过多行注释（/* ... */）
    void skipMultiLineComment() {
        consume(); // 消费 '/'
        consume(); // 消费 '*'
        while (true) {
            if (peek() == EOF) break;
            if (peek() == '*' && pos + 1 < input.size() && input[pos + 1] == '/') {
                consume(); // 消费 '*'
                consume(); // 消费 '/'
                break;
            }
            consume();
        }
    }

    // 扫描标识符或关键字
    Token scanIdentifier() {
        int startLine = line;
        int startCol = column;
        string id;

        id += consume(); // 首字符是字母或下划线
        while (isalnum(peek()) || peek() == '_') {
            id += consume();
        }

        // 匹配关键字
        if (id == "int") return Token(INT, id, startLine, startCol);
        else if (id == "void") return Token(VOID, id, startLine, startCol);
        else if (id == "if") return Token(IF, id, startLine, startCol);
        else if (id == "else") return Token(ELSE, id, startLine, startCol);
        else if (id == "while") return Token(WHILE, id, startLine, startCol);
        else if (id == "break") return Token(BREAK, id, startLine, startCol);
        else if (id == "continue") return Token(CONTINUE, id, startLine, startCol);
        else if (id == "return") return Token(RETURN, id, startLine, startCol);
        else return Token(IDENT, id, startLine, startCol);
    }

    // 扫描整数
    Token scanNumber() {
        int startLine = line;
        int startCol = column;
        string num;

        // 处理数字主体
        if (peek() == '0') {
            num += consume();
            // 允许前导零后接数字，如 0123
            while (isdigit(peek())) {
                num += consume();
            }
        } else if (isdigit(peek())) {
            while (isdigit(peek())) {
                num += consume();
            }
        }

        return Token(NUMBER, num, startLine, startCol);
    }

    // 扫描运算符
    Token scanOperator() {
        int startLine = line;
        int startCol = column;
        char c = consume();

        switch (c) {
            case '+': return Token(PLUS, "+", startLine, startCol);
            case '-': return Token(MINUS, "-", startLine, startCol);
            case '*': return Token(MUL, "*", startLine, startCol);
            case '/': return Token(DIV, "/", startLine, startCol);
            case '%': return Token(MOD, "%", startLine, startCol);
            case '=':
                if (peek() == '=') {
                    consume();
                    return Token(EQ, "==", startLine, startCol);
                }
                return Token(ASSIGN, "=", startLine, startCol);
            case '!':
                if (peek() == '=') {
                    consume();
                    return Token(NEQ, "!=", startLine, startCol);
                }
                return Token(NOT, "!", startLine, startCol);
            case '<':
                if (peek() == '=') {
                    consume();
                    return Token(LE, "<=", startLine, startCol);
                }
                return Token(LT, "<", startLine, startCol);
            case '>':
                if (peek() == '=') {
                    consume();
                    return Token(GE, ">=", startLine, startCol);
                }
                return Token(GT, ">", startLine, startCol);
            case '&':
                if (peek() == '&') {
                    consume();
                    return Token(AND, "&&", startLine, startCol);
                }
                // 单'&'不属于ToyC运算符，临时返回PLUS
                return Token(PLUS, "&", startLine, startCol);
            case '|':
                if (peek() == '|') {
                    consume();
                    return Token(OR, "||", startLine, startCol);
                }
                // 单'|'不属于ToyC运算符，临时返回PLUS
                return Token(PLUS, "|", startLine, startCol);
            default:
                // 临时返回PLUS，理论上不会执行，因为调用前已过滤运算符字符
                return Token(PLUS, string(1, c), startLine, startCol);
        }
    }

    // 扫描分隔符
    Token scanDelimiter() {
        int startLine = line;
        int startCol = column;
        char c = consume();

        switch (c) {
            case ';': return Token(SEMICOLON, ";", startLine, startCol);
            case '{': return Token(LBRACE, "{", startLine, startCol);
            case '}': return Token(RBRACE, "}", startLine, startCol);
            case '(': return Token(LPAREN, "(", startLine, startCol);
            case ')': return Token(RPAREN, ")", startLine, startCol);
            case ',': return Token(COMMA, ",", startLine, startCol);
            default:
                // 临时返回SEMICOLON
                return Token(SEMICOLON, string(1, c), startLine, startCol);
        }
    }

public:
    Lexer(const string& in) : input(in), pos(0), line(1), column(1) {}

    // 获取下一个 Token
    Token getNextToken() {
        skipWhitespaceAndComments();

        char c = peek();
        if (c == EOF) {
            return Token(EOF_TOKEN, "", line, column);
        }

        if (isalpha(c) || c == '_') {
            return scanIdentifier();
        } else if (isdigit(c)) {
            return scanNumber();
        } else if (c == '+' || c == '-' || c == '*' || c == '/' || c == '%' ||
                   c == '=' || c == '!' || c == '<' || c == '>' || c == '&' || c == '|') {
            return scanOperator();
        } else if (c == ';' || c == '{' || c == '}' || c == '(' || c == ')' || c == ',') {
            return scanDelimiter();
        } else {
            // 未知字符，临时返回PLUS
            int startLine = line;
            int startCol = column;
            string val(1, consume());
            return Token(PLUS, val, startLine, startCol);
        }
    }
};

int main() {
    // 读取全部输入
    string input;
    char c;
    while (cin.get(c)) {
        input += c;
    }

    Lexer lexer(input);
    int tokenCount = 0;

    while (true) {
        Token token = lexer.getNextToken();
        if (token.type == EOF_TOKEN) {
            break;
        }

        // 格式化输出：<序号>:<类型>:<内容>
        cout << tokenCount << ":";
        string typeStr;
        string valStr = "\"" + token.value + "\"";

        // 根据 Token 类型选择输出字符串
        switch (token.type) {
            // 关键字
            case INT: typeStr = "'int'"; break;
            case VOID: typeStr = "'void'"; break;
            case IF: typeStr = "'if'"; break;
            case ELSE: typeStr = "'else'"; break;
            case WHILE: typeStr = "'while'"; break;
            case BREAK: typeStr = "'break'"; break;
            case CONTINUE: typeStr = "'continue'"; break;
            case RETURN: typeStr = "'return'"; break;
            // 标识符和数字
            case IDENT: typeStr = "Ident"; break;
            case NUMBER: typeStr = "IntConst"; break;
            // 运算符
            case PLUS: typeStr = "'+'"; break;
            case MINUS: typeStr = "'-'"; break;
            case MUL: typeStr = "'*'"; break;
            case DIV: typeStr = "'/'"; break;
            case MOD: typeStr = "'%'"; break;
            case ASSIGN: typeStr = "'='"; break;
            case EQ: typeStr = "'=='"; break;
            case NEQ: typeStr = "'!='"; break;
            case LT: typeStr = "'<'"; break;
            case GT: typeStr = "'>'"; break;
            case LE: typeStr = "'<='"; break;
            case GE: typeStr = "'>='"; break;
            case AND: typeStr = "'&&'"; break;
            case OR: typeStr = "'||'"; break;
            case NOT: typeStr = "'!'"; break;
            // 分隔符
            case LPAREN: typeStr = "'('"; break;
            case RPAREN: typeStr = "')'"; break;
            case LBRACE: typeStr = "'{'"; break;
            case RBRACE: typeStr = "'}'"; break;
            case SEMICOLON: typeStr = "';'"; break;
            case COMMA: typeStr = "','"; break;
            // 其他情况，如未知类型，临时处理
            default: typeStr = "Unknown"; break;
        }

        cout << typeStr << ":" << valStr << endl;
        tokenCount++;
    }

    return 0;
}